//
// Created by f on 2022/3/17.
//

#include <memory>
#include "grid_map.h"
#include "quadtree_map.h"

int main(){
    std::shared_ptr<QuadtreeMap> map_ptr;
/*
    map_ptr = std::make_shared<GridMap>(0,0,M_PI/36,0.1,1000,1000,1);

    std::cout<<map_ptr->Center_yaw();
    for(double x=0;x<1000;x+=0.09)
        for(double y=0;y>-1000;y-=0.09)
            map_ptr->AddPoint(x, y);

    map_ptr->SaveMap("", "PNG");
    map_ptr = std::make_shared<GridMap>(1);
    map_ptr->LoadMap("gridmap_0.000000_0.000000_0.523599_0.100000.png","PNG");
    for(double x=-1000;x<0;x+=0.05)
        for(double y=1000;y>0;y-=0.05)
            map_ptr->AddPoint(x, y);
    map_ptr->SaveMap("../", "PNG");
*/
//    map_ptr = std::make_shared<QuadtreeMap>(0,0,0,0.1,200,0);
//    for(double x=-100;x<=0;x+=0.05)
//        for(double y=-100;y<=0;y+=0.05)
//            map_ptr->AddPoint(x,y);
//
//    map_ptr->ShowTree();
//    map_ptr->SaveMap("","PNG");
//    map_ptr = std::make_shared<QuadtreeMap>(20,15,M_PI/9,0.1,1000,0);
//    for(double x=-1000;x<=0;x+=0.05)
//        for(double y=-1000;y<=0;y+=0.05)
//            map_ptr->AddPoint(x,y);
//    map_ptr->SaveMap("../","BIN");
//    map_ptr->SaveMap("../","PNG");
    map_ptr = std::make_shared<QuadtreeMap>(1);
    map_ptr->LoadMap("../quadtreemap_20.000000_15.000000_0.349066_0.100000.bin", "BIN");
    map_ptr->SaveMap("","BIN");
    map_ptr->SaveMap("","PNG");

    return 0;
}

